SpatialAudioRendererOptions

Configuration shared by the 2D and 3D spatial renderers.

interface SpatialAudioRendererOptions extends SpatialAttenuationOptions {
    label: string | null;
    smoothing: number;
    crossfadeTime: number;
    lowpassMaxFrequency: number;
    lowpassMinFrequency: number;
    rearLowpassFactor: number;
    reverbMinSend: number;
    reverbMaxSend: number;
    silenceThreshold: number;
    maxVoices: number;
    clustering: Partial<SpatialClusteringOptions>;
    limiter: boolean | Partial<LimiterOptions>;
    output: Channel | Master | null;
    loopVirtualizationDelay: number;
}

About

Base options of SpatialAudioRenderer. Extended by SpatialAudioRenderer2DOptions and SpatialAudioRenderer3DOptions. Every field is optional.

The renderer maps the normalized distance (0 at refDistance, 1 at maxDistance) to:

  • Lowpass cutoff: logarithmically from lowpassMaxFrequency to lowpassMinFrequency, multiplied by up to rearLowpassFactor for sources behind the listener.
  • Reverb send: from reverbMinSend to reverbMaxSend, following a square root curve, multiplied by the source's reverbSendFactor.

Properties

  • label: string | null - Custom label. Default null.
  • distanceModel, refDistance, maxDistance, rolloffFactor - Default attenuation for all sources. See SpatialAttenuationOptions.
  • smoothing: number - Time constant (seconds) used to smooth parameter changes. Default 0.05.
  • crossfadeTime: number - Crossfade time (seconds) when a source moves between voices. Default 0.12.
  • lowpassMaxFrequency: number - Lowpass cutoff (Hz) at refDistance. Default 20000.
  • lowpassMinFrequency: number - Lowpass cutoff (Hz) at maxDistance. Default 600.
  • rearLowpassFactor: number - Extra cutoff multiplier for sources directly behind the listener. 1 disables it. Default 0.6.
  • reverbMinSend: number - Reverb send at refDistance. Default 0.05.
  • reverbMaxSend: number - Reverb send at maxDistance. Default 0.6.
  • silenceThreshold: number - Gain below which a source is inaudible and gets no voice. It becomes audible again at twice this value. Default 0.001.
  • maxVoices: number - Maximum number of voices (a cluster counts as one). Above it, the quietest sources become virtual. Default 64 (2D) or 32 (3D). See Voice budget.
  • clustering: Partial<SpatialClusteringOptions> - Clustering configuration.
  • limiter: boolean | Partial<LimiterOptions> - Safety Limiter on the renderer's output. false disables it, an object configures it. Default true, or false when an output is given (the output is then owned by your game).
  • output: Channel | Master | null - Where the renderer sends its sound and its reverb, for example an "Entities" bus. null creates a master channel for the renderer. See Buses. Default null.
  • loopVirtualizationDelay: number - Seconds a source must be without a voice before its looping sounds are suspended (their audio nodes released), and resumed in time once it has a voice again. Infinity disables it. See Loop virtualization. Default 0.5.